FIND_PACKAGE(LibLZMA)

SET(CPACK_RPM_provider-lzma_PACKAGE_SUMMARY "LZMA compression support in the server and storage engines" PARENT_SCOPE)
SET(CPACK_RPM_provider-lzma_PACKAGE_DESCRIPTION "LZMA compression support in the server and storage engines" PARENT_SCOPE)

IF (LIBLZMA_FOUND)
  GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
  LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
  SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")

  INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})

  MYSQL_ADD_PLUGIN(provider_lzma plugin.c COMPONENT provider-lzma
    LINK_LIBRARIES ${LIBLZMA_LIBRARIES} CONFIG provider_lzma.cnf)
ENDIF()
